/*
 * @Description: 公共请求4.0下拉、字典数据
 * @Author: Liu Zhiwang
 * @Date: 2021-09-03 15:04:06
 * @LastEditTime: 2021-09-30 15:12:00
 * @LastEditors: Huang Junjie
 */
import request from '@/utils/request'

// 获取当前登入人可以管理的部门
export function findManageDeptTree(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/dept/findManageDeptTree') : '/jcwBasic/dept/findManageDeptTree',
    method: 'GET',
    params: params
  })
}

// 获取接触网工区
export function findWorkDeptList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/dept/findWorkDeptList') : '/jcwBasic/dept/findWorkDeptList',
    method: 'GET',
    params: params
  })
}

// 获取当前登入人可以管理的车间工区
export function findWorkShopAndWorkAreaTree(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/dept/findWorkShopAndWorkAreaTree') : '/jcwBasic/dept/findWorkShopAndWorkAreaTree',
    method: 'GET',
    params: params
  })
}

// 获取当前登入人可以管理的人员信息
export function getStaffList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/staff/findStaffList') : '/jcwBasic/staff/findStaffList',
    method: 'get',
    params: params
  })
}

//  线路树状结构（权限）
export function getSeclineTree(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcSecline/getSeclineTreeByAuth') : '/jcwBasic/jcSecline/getSeclineTreeByAuth',
    method: 'GET',
    params: params
  })
}

//  线路树状结构（没有权限）
export function getSeclineTreeNoAuth(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcSecline/getSeclineTree') : '/jcwBasic/jcSecline/getSeclineTree',
    method: 'GET',
    params: params
  })
}

// 区间战场
export function getLineSiteList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/list') : '/jcwBasic/jcLineSite/list',
    method: 'GET',
    params: params
  })
}

// 区间战场（分页）
export function getLineSitePageList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcLineSite/pageData') : '/jcwBasic/jcLineSite/pageData',
    method: 'GET',
    params: params
  })
}

// 行别
export function getDirectionList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcDirection/list') : '/jcwBasic/jcDirection/list',
    method: 'GET',
    params: params
  })
}

// 股道
export function getTrackList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcTrack/list') : '/jcwBasic/jcTrack/list',
    method: 'GET',
    params: params
  })
}

// 隧道
export function getTunnelList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcTunnel/list') : '/jcwBasic/jcTunnel/list',
    method: 'GET',
    params: params
  })
}

// 锚段
export function getAnchorList(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwAnchor/listData') : '/jcwBasic/jcwAnchor/listData',
    method: 'GET',
    params: params
  })
}

// 查询设备分类列表
export function getDeviceclassTree(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcwDeviceclass/getConditionTree') : '/jcwBasic/jcwDeviceclass/getConditionTree',
    method: 'GET',
    params: params
  })
}

// 获取oracle字典数据
export function getListByDtId(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/dict/getByParams') : '/jcwBasic/dict/getByParams',
    method: 'GET',
    params: params
  })
}
